<?php
namespace app\index\model;

use think\Model;

class Goods extends Model
{
	protected $insert = ['date'];

	protected function setDateAttr()
	{
		return time();
	}

	public function time(){
		return $this->hasMany('GoodsNext','goods_id','id')->field('id,goods_id,title,desc,link,kaibo_time');
	}

    public function items(){
        return $this->hasMany('GoodsNext','goods_id','id')->field('id,goods_id,title');
    }

    /*
     * 条件
     *
     * */
	public function goodsNext(){
	   return self::alias('g')->join('goods_next gn','g.id=gn.goods_id')
            ->select();
    }


}

?>

